<?php

namespace App\Http\Requests;

use App\Http\Requests\Request;

class ArticleRequest extends Request
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true; //改为true 做权限验证
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */

        //请求信息和规则
    public function rules()
    {
            //填写表单验证规则
        return [
            'title'=>'required|regex:/\S{6,18}/',//必填字段
            'editorValue'=>'required',
            'descr'=>'required',
        ];
    }

    //报错信息
    public function messages(){
        return [
            'title.required'=>'标题不能为空',
            'title.regex'=>'必须是6-18位非空字符',
            'editorValue.required'=>'内容不能为空',
            'descr.required'=>'描述不能为空',
            ];
    }
}
